package com.aaa.controller;


import com.aaa.entity.User;
import com.aaa.service.UserService;
import com.aaa.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("system/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/add")
    public Result<String> add(){

        return userService.add();
    }

    @GetMapping("getByUsername/{username}")
    public User getByUsername(@PathVariable String username){
        return userService.findByUsername(username);
    }

    @PostMapping("/queryUserNeedScheduling")
    public List<User> queryUserNeedScheduling(@RequestBody Map<String,Object> map){
        return userService.queryUserNeedScheduling(map);
    }
    @GetMapping("/initUser")
    public List<User> initUser(){
        return userService.initUser();
    }

    @GetMapping("/queryUserByPhone/{phone}")
    public User queryUserByPhone(@PathVariable Long phone){
        return userService.queryUserByPhone(phone);
    }

    @GetMapping("/aaa")
    public Result<String> reg(User user){
        return userService.reg(user);
    }


}
